package cn.itcast.job;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;

@Slf4j
public class MySimpleJob implements SimpleJob {
    @Override
    public void execute(ShardingContext shardingContext) {
        int totalCount = shardingContext.getShardingTotalCount(); //分片总数量
        int item = shardingContext.getShardingItem();//当前分片
        log.info("作业任务被执行了" + new Date() + "总分片数量" + totalCount + "当前分片:" + item);
    }
}
